Revert "x86/hvm: disable pkeys for guests in non-paging mode"
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 25 May 2017 17:17:01 +0000 (18:17 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 1 Jun 2017 13:13:57 +0000 (14:13 +0100)
commit224acdd04a9f6ffe44d2f716287cac74787899ec
tree38c4344b42b98a6b13850a9e651d9267ae4042e8
parentd8b833d78f6bfde9855a949b5e6d3790d78c0fb7
Revert "x86/hvm: disable pkeys for guests in non-paging mode"

This reverts commit c41e0266dd59ab50b7a153157e9bd2a3ad114b53.

When determining Access Rights, Protection Keys only take effect when CR4.PKE
it set, and 4-level paging is active.  All other circumstances (notibly, 32bit
PAE paging) skip the Protection Key control mechanism.

Therefore, we do not need to clear CR4.PKE behind the back of a guest which is
not using paging, as such a guest is necesserily running with EFER.LMA
disabled.

The {RD,WR}PKRU instructions are specified as being legal for use in any
operating mode, but only if CR4.PKE is set.  By clearing CR4.PKE behind the
back of an unpaged guest, these instructions yield #UD despite the guest
correctly seeing PKE set if it reads CR4, and OSPKE being visible in CPUID.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Huaitong Han <huaitong.han@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/vmx/vmx.c